import { Session } from '/@/utils/storage';
export const tableOption = {
  border: true,
  index: true,
  indexLabel: '序号',
  stripe: true,
  menuAlign: 'center',
  align: 'center',
  labelWidth: '160',
  searchMenuSpan: 6,
  indexWidth: '60',
  columnBtn: false,
  editBtn:false,
  delBtn:false,
  searchEnter:true,
  searchLabelWidth: 'auto',
  searchMenuPosition: 'left',
  column: [
    // {
    //   "type": "input",
    //   "label": "主键",
    //   "prop": "evId",
    //   "addDisplay": false,
    //   "editDisabled": true
    // },
    {
      type: 'input',
      label: '事件编号',
      prop: 'eventNo',
      addDisplay: false,
      editDisabled: true,
      overHidden: true,
      width: 150,
      search: true
    },
    {
      type: 'select',
      label: '事件类型',
      prop: 'eventType',
      // dicUrl: '/om/omodict/item/select?dictKey=event_level',
      dicUrl: '/api/admin/omodict/item/select?dictKey=event_type',
      // dicUrl: '/api/admin/omodict/item/select/event_type',
      dicHeaders: {
        authorization: 'Bearer ' + Session.get('token'),
      },
      props: {
        label: 'label',
        value: 'value'
      },
      width: 150,
      search: true
    },
    {
      type: 'input',
      label: '事件名称',
      prop: 'eventName',
      width: 150,
      overHidden: true,
      search: true,
      rules: [
        {
          required: true,
          message: '请输入事件名称',
          trigger: 'blur'
        }
      ]
    },
    {
      type: 'select',
      label: '事件来源',
      prop: 'eventFromType',
      dicUrl: '/api/admin/omodict/item/select?dictKey=event_from',
      dicHeaders: {
        authorization: 'Bearer ' + Session.get('token'),
      },
      props: {
        label: 'label',
        value: 'value'
      },
      width: 150
    },
    {
      type: 'select',
      label: '事件程度', //0：特急，1：紧急，2：一般
      prop: 'eventLevel',
      dicUrl: '/api/admin/omodict/item/select?dictKey=event_level',
      dicHeaders: {
        authorization: 'Bearer ' + Session.get('token'),
      },
      props: {
        label: 'label',
        value: 'value'
      },
      width: 150
    },
    {
      // type: 'input',
      label: '设备名称',
      prop: 'equipName',
      hide: true
    },

    // {
    //   type: 'input',
    //   label: '设备编号22',
    //   prop: 'equipNo',
    //   width: 150,
    //   addDisabled: true,
    //   editDisabled: true,
    //   overHidden: true,
    //   hide: true
    // },
    {
      type: 'input',
      label: '事件报告人',
      prop: 'eventUserName',
      searchLabelWidth: '100',
      search: true,
      rules: [
        {
          pattern: /^[\u4e00-\u9fa5]{2,6}$/,
          message: '请输入正确姓名格式',
          trigger: 'blur'
        }
      ],
      width: 150
    },
    {
      type: 'input',
      label: '报告人电话',
      prop: 'eventUserPhone',
      rules: [
        {
          pattern: /^1[3456789]\d{9}$/,
          message: '请输入正确手机号',
          trigger: 'blur'
        }
      ],
      hide: true,
      width: 150
    },

    // {
    //   // type: "input",
    //   label: '事件区域',
    //   prop: 'eventArea',
    //   width: 150,
    //   hide: true,
    //   overHidden: true,
    //   // rules: [
    //   //   {
    //   //     required: true,
    //   //     message: '请选择区域',
    //   //     trigger: 'blur'
    //   //   }
    //   // ]
    // },

    {
      type: 'textarea',
      label: '事件内容',
      prop: 'eventDesc',
      width: 150,
      span: 24,
      overHidden: true
    },
    {
      label: '上传图片',
      prop: 'fileList',
      hide: true,
      dataType: 'array',
      span: 24
    },

    // {
    //   type: 'tree',
    //   label: '设备栏目',
    //   prop: 'assetsType',
    //   filterable: true,
    //   hide: true,
    //   dicUrl: `/bm/bamaassetscloumn/fullTreeMenu?lazy=true&level=1`,
    //   props: {
    //     label: 'name',
    //     value: 'id'
    //   },
    //   width: 150,
    //   overHidden: true,
    //   editDisplay: false
    // },
    // {
    //   label: '设备类型',
    //   prop: 'modelType',
    //   hide: true,
    //   editDisplay: false,
    //   width: 150
    // },
    // {
    //   label: '设备型号',
    //   prop: 'devType',
    //   hide: true,
    //   editDisplay: false,
    //   width: 150
    // },

    // {
    //   type: 'input',
    //   label: '设备名称',
    //   prop: 'equipName',
    //   addDisplay: false,
    //   editDisabled: false,
    //   hide: true
    // },
    {
      type: 'select',
      label: '事件状态', //0：未处理，1：事件挂起，2：事件关闭，3：已生成工单，4：已评价
      prop: 'eventStatus',
      dicUrl: '/api/admin/omodict/item/select?dictKey=event_status',
      dicHeaders: {
        authorization: 'Bearer ' + Session.get('token'),
      },
      props: {
        label: 'label',
        value: 'value'
      },
      width: 150,
      addDisplay: false,
      editDisabled: true,
      search: true
    },

    {
      type: 'tree',
      label: '处理人部门',
      prop: 'handleUserDeptId',
      filterable: true,
      // editDisplay: false,
      width: 100,
      props: {
        label: 'name',
        value: 'id'
      },
      cascader: ['handleUserId'],
      dicUrl: `/api/admin/dept/tree`,
      dicHeaders: {
        authorization: 'Bearer ' + Session.get('token'),
      },
      hide: true,
      addDisplay: false,
      editDisabled: true
      // editDisplay: false
    },
    {
      type: 'select',
      label: '处理人',
      prop: 'handleUserId',
      filterable: true,
      props: {
        label: 'name',
        value: 'userId'
      },
      dicUrl: `/api/admin/user/userswithdept/{{key}}`,
      dicHeaders: {
        authorization: 'Bearer ' + Session.get('token'),
      },
      hide: true,
      width: 150,
      addDisplay: false,
      editDisabled: true
    },
    {
      type: 'input',
      label: '处理人',
      prop: 'handleUserName',
      addDisplay: false,
      editDisplay: false,
      width: 150
    },
    {
      type: 'input',
      label: '处理人电话',
      prop: 'handleUserPhone',
      rules: [
        {
          pattern: /^1[3456789]\d{9}$/,
          message: '请输入正确手机号',
          trigger: 'blur'
        }
      ],
      hide: true,
      addDisplay: false,
      editDisplay: false,
      width: 150
    },
    {
      type: 'datetime',
      label: '处理时间',
      prop: 'handleTime',
      width: 180,
      addDisplay: false,
      editDisabled: true
    }
  ]
}
export const tableOption3 = {
  border: true,
  index: false,
  indexLabel: '序号',
  stripe: true,
  menuAlign: 'center',
  align: 'center',
  searchMenuSpan: 6,
  menuWidth: 238,
  labelWidth: '130',
  indexWidth: '60',
  menu: false,
  addBtn: false,
  columnBtn: false,
  searchShowBtn: false,
  refreshBtn: false,
  selection: false,
  cellBtn: true,
  column: [
    {
      label: '序号',
      prop: 'radio',
      width: 60,
      hide: false
    },
    {
      // type: 'tree',
      label: '系统名称',
      prop: 'modelType2',
      search: true,
      hide: true,
      addDisplay: false,
      editDisplay: false,
      searchSpan: 4
    },
    {
      // type: 'tree',
      label: '安装区域',
      prop: 'placeno',
      dicUrl: `/bm/bamssubarea/tree?lazy=false`,
      dicMethod: 'get',
      props: {
        label: 'name',
        value: 'id'
      },
      rules: [
        {
          required: true,
          message: '请选择安装区域',
          trigger: 'blur'
        }
      ]
    },
    {
      // type: 'input',
      label: '设备位置编码',
      prop: 'unitNo',
      overHidden: true,
      hide: true
    },

    {
      // type: 'select',
      label: '资产类型',
      search: true,
      hide: true,
      addDisplay: false,
      editDisplay: false,
      prop: 'deviceType',
      searchSpan: 4
    },
    {
      // type: 'select',
      label: '资产型号',
      search: true,
      hide: true,
      addDisplay: false,
      editDisplay: false,
      prop: 'devType2',
      searchSpan: 4
    },
    {
      label: '资产栏目',
      prop: 'modelType',
      hide: true
    },

    {
      // type: 'select',
      label: '资产类型',
      prop: 'unmodel',
      hide: true,
      editDisabled: true
    },
    {
      // type: 'select',
      label: '资产型号',
      // addDisabled: true,
      prop: 'devType',
      dicUrl: `/bm/bamaassetsmodel/getAssetsModelBy`,
      dicMethod: 'post',
      props: {
        label: 'bamAAssetsModelCn',
        value: 'bamAAssetsDeviceCode'
      },

      rules: [
        {
          required: true,
          message: '请选择资产类型',
          trigger: 'blur'
        }
      ]
    },
    {
      // type: 'input',
      label: '资产名称',
      prop: 'assetsName',
      rules: [
        {
          required: true,
          message: '请选择资产名称',
          trigger: 'blur'
        }
      ],
      hide: true,
      // formslot: true,
      // slot: true
      addDisplay: true,
      editDisplay: false,
      overHidden: true
    },
    {
      // type: 'input',
      label: '设备名称',
      prop: 'deviceName',
      search: true,
      searchSpan: 4
    },

    {
      type: 'input',
      label: '设备编号',
      prop: 'deviceNo',
      hide: true,
      addDisplay: true,
      editDisplay: true,
      addDisabled: true,
      editDisabled: true
    },

    {
      type: 'input',
      label: '安装位置描述',
      prop: 'placeremark'
    },

    {
      type: 'input',
      label: '设备sn码',
      prop: 'unitsn',
      rules: [
        {
          pattern: /^[a-zA-Z0-9]+$/,
          message: '请输入正确设备sn码，包含数字或英文',
          trigger: 'blur'
        }
      ]
    },

    {
      type: 'select',
      // label: '在线离线状态：0离线，1在线',
      label: '在线状态',
      search: false,
      formatter: (val) => {
        return val.onlineStatus === 0 ? '离线' : '在线'
      },

      prop: 'onlineStatus',
      props: {
        label: 'label',
        value: 'value'
      },
      dicData: [
        {
          label: '离线',
          value: 0
        },
        {
          label: '在线',
          value: 1
        }
      ],
      addDisplay: false,
      editDisabled: true,
      placeholder: null
    },
    {
      type: 'select',
      // label: '工作状态，0-关机 1-开机 2-故障',
      label: '工作状态',
      formatter: (val) => {
        return val.workingStatus === 0 ? '关机' : val.employStatus === 1 ? '开机' : '故障'
      },
      // search: true,
      prop: 'workingStatus',
      props: {
        label: 'label',
        value: 'value'
      },
      dicData: [
        {
          label: '关机',
          value: 0
        },
        {
          label: '开机',
          value: 1
        },
        {
          label: '故障',
          value: 2
        }
      ],
      addDisplay: false,
      editDisabled: true
    },
    {
      type: 'input',
      label: '故障码',
      prop: 'errorStatus',
      addDisplay: false,
      hide: true
    },
    {
      type: 'input',
      label: '上线时间',
      prop: 'onlinedate',
      addDisplay: false,
      editDisplay: false,
      width: '160',
      hide: true
    }
  ]
}
// 工单  - 事件管理  - 选择设备  设备列表
export const tableOption4 = {
  border: true,
  index: false,
  indexLabel: '序号',
  stripe: true,
  menuAlign: 'center',
  align: 'center',
  searchMenuSpan: 6,
  menuWidth: 238,
  labelWidth: '130',
  indexWidth: '60',
  menu: false,
  addBtn: false,
  columnBtn: false,
  searchShowBtn: false,
  refreshBtn: false,
  selection: false,
  cellBtn: true,
  column: [
    {
      label: '序号',
      prop: 'radio',
      width: 60,
      hide: false
    },
   
    {
      // type: 'input',
      label: '设备名称',
      search: true,
      prop: 'deviceName',
    },

    {
      // type: 'select',
      label: '所属产品',
      search: true,
      prop: 'productName',
    },
    {
      // type: 'select',
      label: '所属位置',
      search: true,
      prop: 'subareaCn'
    },
   
   
    {
      type: 'select',
      // label: '在线离线状态：0离线，1在线',
      label: '状态',
      search: false,
      formatter: (val) => {
        return val.onlineStatus === 0 ? '离线' : '在线'
      },

      prop: 'onlineStatus',
      props: {
        label: 'label',
        value: 'value'
      },
      dicData: [
        {
          label: '离线',
          value: 0
        },
        {
          label: '在线',
          value: 1
        }
      ],
      addDisplay: false,
      editDisabled: true,
      placeholder: null
    },
    {
      // type: 'select',
      label: '备注',
      prop: 'remark'
    },
  ]
}
